<template>
	<view class="">
		<view class="swiper">
			<view class="s_title">
				会员中心
			</view>
			<swiper style="height: 360rpx;" previous-margin="10" next-margin="10" :autoplay="false" radius="5" bgColor="#ffffff" :current="current" @change="changeSwiper">
				<swiper-item v-for="(item,index) in list3" :key="index">
					<view class="swiper-item uni-bg-red">
						<image :src="item.bg_img" mode="widthFix"></image>
						<view class="s_vip_info">
							<view class="s_vip_name">
								{{item.member_name}}
							</view>
							<view class="s_vip_remark">
								永久有效
							</view>
						</view>
						<view class="s_bottom">
							{{item.notes}}
						</view>
						

						<image @click="toCode" v-if="item.tips==1" class="code" src="https://img-cdn.duobashuzi.com/xianggui/img/xgj/code-icon.png" ></image>
						<image v-if="item.tips==1" class="biao" src="https://img-cdn.duobashuzi.com/xianggui/img/xgj/jb.png" mode="widthFix" ></image>
					</view>
				</swiper-item>
			</swiper>
			<!-- 图标 -->
			<view class="icons">
				<view class="icon_item">
					<image src="https://img-cdn.duobashuzi.com/xiangguijia/v-icon1.png" mode="widthFix"></image>
					<view class="">
						{{zhekou}}折
					</view>
				</view>
				<view class="icon_item">
					<image src="https://img-cdn.duobashuzi.com/xiangguijia/v-icon2.png" mode="widthFix"></image>
					<view class="">
						会员价活动
					</view>
				</view>
				<view class="icon_item">
					<image src="https://img-cdn.duobashuzi.com/xiangguijia/v-icon3.png" mode="widthFix"></image>
					<view class="">
						包邮
					</view>
				</view>
			</view>
		</view>
		<!-- 更多个性化 -->
		<view id="recommend"  class="recommendli">
			<u-divider text="更多个性化推荐"></u-divider>
			<sheet-recommend :isType.sync="isType" ref="getXgjgoodlist"></sheet-recommend>
		</view>
	</view>
</template>

<script>
	import {memberList} from '@/api/my.js'
	import sheetRecommend from "@/components/sheet/sheetRecommend.vue"
	export default {
		data() {
			return {
				isType:1,
				list3: [{
					bg_img: 'https://img-cdn.duobashuzi.com/xiangguijia/v1.png',
					member_name: '黄金会员',
					notes: ''
				},{
					bg_img: 'https://img-cdn.duobashuzi.com/xiangguijia/v1.png',
					member_name: '黄金会员',
					notes: ''
				}],
				current:0,
				zhekou:9.1
			}

		},
		components:{
			sheetRecommend
		},
		onLoad(options) {
			this.current = Number(options.level)-1
			this.$nextTick(()=>{
				
				this.$refs.getXgjgoodlist.getRecommendlist();
			})
		},
		mounted() {
			this.getMemberList()
		},
		methods: {
			toCode(){
				uni.navigateTo({
					url:"/package/qrcode/index"
				})
			},
			getMemberList(){
				memberList({}).then(res=>{
					this.list3 = res.data
					this.zhekou = this.list3[this.current].discont
				})
			},
			changeSwiper(e){
				console.log(e)
				this.zhekou = this.list3[e.detail.current].discont
			}
		}
	}
</script>

<style lang="scss">
	.swiper {
		padding-top: 120rpx;
		padding-bottom: 10px;
		background: url('https://img-cdn.duobashuzi.com/xiangguijia/vip_head_bg.png') no-repeat;
		background-size: 100% 100%;	
		.s_title {
			text-align: center;
			font-size: 14px;
			margin-bottom: 30rpx;
			color: #fff;
		}
	}

	.swiper-item {
		position: relative;
		// height: 360rpx;
		text-align: center;
		margin-right: 10px;
		image{
			width: 100%;
		}
		.s_vip_info{
			position: absolute;
			left: 12px;
			top: 18px;
			text-align: left;
			.s_vip_name{
				font-size: 18px;
				font-weight: 700;
				margin-bottom: 6px;
				color: #fff;
			}
			.s_vip_remark{
				font-size: 12px;
				color: #eee;
			}
		}
		.s_bottom{
			position: absolute;
			left: 12px;
			bottom: 18px;
			font-size: 14px;
			color: #fff;
		}
		.code{
			position: absolute;
			top: 26px;
			right: 12px;
			width: 20px;
			height: 20px;
		}
		.biao{
			position: absolute;
			top: 0;
			right: 0;
			width: 120rpx;
		}
	}
	
	.icons{
		width: 80%;
		margin: 16px auto 0;
		display: flex;
		justify-content: space-around;
		.icon_item{
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			font-size: 12px;
			color: #ffe8ce;
			image{
				width: 40px;
				margin-bottom: 6px;
			}
		}
	}

</style>